import axios from 'axios'
import {fileStore} from '../store/index'
import {getCookies} from './auth'
import { useRouter } from 'vue-router'


// 获取pinia中的实例
const fileMainStore = fileStore()
const router = useRouter()

const service = axios.create({
  baseURL: 'http://152.136.188.204:9099',
  timeout: 10000
})



// 请求拦截器
service.interceptors.request.use(
  config => {
    config.headers['token'] = getCookies('token')
    return config
  },
  error => {
    return Promise.reject(error)
  }
)

// 响应拦截器
service.interceptors.response.use(
  response => {
    return response
  },
  error => {
    return Promise.reject(error)
  }
)

export default service 


